package server.business.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import server.business.converter.Converter.AboTypeConverter;
import server.business.converter.Converter.BloodLocationConverter;
import server.business.converter.Converter.RhTypeCoverter;
import server.business.converter.Converter.StateConverter;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName blood_information
 * @author Galaxy
 */
@Data
@Accessors(chain = true)
@TableName(value ="blood_information")
@ColumnWidth(20) //列宽
@ContentRowHeight(20)//数据行高
@HeadRowHeight(30)//表头高
@ExcelIgnoreUnannotated   //解决不加ExcelProperty注解的，也会出现在excel中
public class BloodInformation implements Serializable {
    /**
     * 编号
     */
    @ExcelProperty(value = "编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @TableField(value = "gmt_modified")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date gmtModified;

    /**
     * 血装编号条码
     */
    @TableField(value = "barcode")
    @ExcelProperty(value = "血装编号条码")
    private Long barcode;

    /**
     * 扩展码
     */
    @TableField(value = "extend_code")
    @ExcelProperty(value = "拓展码")
    private String extendCode;

    /**
     * 血液成分/血液名称
     */
    @TableField(value = "blood_component")
    @ExcelProperty(value = "血液成分")
    private String bloodComponent;

    /**
     * 规格/血量
     */
    @TableField(value = "blood_count")
    @ExcelProperty(value = "规格")
    private Integer bloodCount;

    /**
     * ABO血型
     */
    @TableField(value = "abo_blood_type")
    @ExcelProperty(value = "ABO血型",converter = AboTypeConverter.class)
    private String aboBloodType;

    /**
     * RH血型
     */
    @TableField(value = "rh_blood_type")
    @ExcelProperty(value = "RH血型",converter = RhTypeCoverter.class)
    private String rhBloodType;

    /**
     * 失效时间
     */
    @TableField(value = "failure_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "失效时间")
    private Date failureTime;

    /**
     * 采集时间
     */
    @TableField(value = "collect_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "采集时间")
    private Date collectTime;

    /**
     * 血液来源
     */
    @TableField(value = "blood_source")
    @ExcelProperty(value = "血液来源")
    private String bloodSource;

    /**
     * 状态
     */
    @TableField(value = "state")
    @ExcelProperty(value = "状态",converter = StateConverter.class)
    private String state;

    /**
     * 入库金额
     */
    @TableField(value = "inbound_amount")
    @ExcelProperty(value = "入库金额")
    private Long inboundAmount;

    /**
     * 血液ID
     */
    @TableField(value = "blood_id")
    @ExcelProperty(value = "血液ID")
    private String bloodId;

    /**
     * 血袋位置
     */
    @TableField(value = "blood_location")
    @ExcelProperty(value = "血袋位置",converter = BloodLocationConverter.class)
    private String bloodLocation;

    /**
     * 血液金额
     */
    @TableField(value = "blood_amount")
    @ExcelProperty(value = "血液金额")
    private Long bloodAmount;

    /**
     * 计量单位
     */
    @TableField(value = "measurement_unit")
    private Integer measurementUnit;

    /**
     * 批次号
     */
    @TableField(value = "batch_number")
    private Long batchNumber;

    /**
     * 1代表已删除，0代表未删除
     */
    @ExcelIgnore
    @TableLogic
    @TableField(value = "is_deleted")
    private Integer isDeleted;

    /**
     * 状态信息
     */
    @TableField(exist = false)
    @ExcelProperty(value = "状态",index = 9)
    private String stateInfo;

    /**
     * abo信息
     */
    @TableField(exist = false)
    @ExcelProperty(value = "ABO血型",index = 4)
    private String aboInfo;

    /**
     * rh信息
     */
    @TableField(exist = false)
    @ExcelProperty(value = "RH血型",index = 5)
    private String rhInfo;

    @TableField(exist = false)
    @ExcelProperty(value = "血袋位置",index = 12)
    private String locationInfo;    //血袋位置中文含义

    @TableField(exist = false)
    private String bloodSizeInfo;   //血液规格中文含义

    @TableField(exist = false)
    private String bloodSourceInfo;

    @TableField(exist = false)
    private static final long serialVersionUID = -5481121851932273050L;
}